/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: liuzicheng
 * @Date: 2025-02-10 14:02:57
 * @LastEditors: liuzicheng
 * @LastEditTime: 2025-02-21 16:32:27
 */
import { IRoute } from "@/vite-env";
import { makeAutoObservable } from "mobx";
// userStore 类型定义
export interface IUserStore {
  roles: string[];
  menuList: any[];
  setRoles: (roles: string[]) => void;
  setMenus: () => void;
}
class UserStore {
  constructor() {
    makeAutoObservable(this);
  }
  roles: string[] = ["admin", "user"];
  menuList: IRoute[] = [];
  setMenus = () => {
    this.menuList = [
      {
        name: "动态路由-消息",
        path: "/message",
        icon: "i-me:user",
        meta: {
          noLayout: false,
          name: "动态路由-消息",
          parentPath: "",
          keepalive: false
        }
      },
      {
        name: "动态路由-消息1",
        path: "/message1",
        icon: "i-me:user",
        meta: {
          noLayout: false,
          name: "动态路由-消息1",
          parentPath: "",
          keepalive: true
        }
      }
    ];
  };
  changeRoles = (a) => {
    this.roles = a; // 'this' 永远都是正确的
  };
}

export default new UserStore();
